package DuoTai;

public class Transport {
    public static void main(String[] args) {
        People p = new People();
        p.how(new Train());
    }
}

class People{
    public void how(Traffic traffic){
        traffic.go();
    }
}

class Traffic{
    public void go(){
        System.out.println("去北京");
    }
}

class Airport extends Traffic{
    public void go(){
        System.out.println("坐飞机去北京");
    }
}

class Train extends Traffic{
    public void go(){
        System.out.println("坐火车去北京");
    }
}

class Steamer extends Traffic{
    public void go(){
        System.out.println("坐轮船去北京");
    }
}
